package model;

import helper.Configuration;
import helper.HttpHandler;

import java.util.Hashtable;

import javax.microedition.lcdui.Image;

public class StaticMap
{
	private Hashtable config;
	private HttpHandler http;
	
	public StaticMap()
	{
		this.config = (new Configuration()).loadConfiguration();
		this.http = new HttpHandler();
	}
	
	public Image getMap(String coordinates,int zoom, int width, int height)
	{
		String apikey = (String) this.config.get("apikey");
		String url = (String) this.config.get("staticapiurl");
		url += "?center=" + coordinates;
		url += "&format=xml"; 
		url += "&zoom=" + zoom;
		url += "&size=" + width + "x" + height;
		url += "&key=" + apikey;
		
		System.out.println(url);
		
		return this.http.httpGetImage(url);
	}
}
